package spring_root.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import spring_root.po.Person;
import spring_root.service.personSerivce;

@Controller
public class personController {
	
	@Autowired
	private personSerivce ps;
	
	@RequestMapping(value="/hello")
	@ResponseBody
	public String hello() {
		return "你好 spring boot";
	}
	
	/*@RequestMapping(value="/index")
	public String index() {.
		
		return "/";
	}*/
	
	@RequestMapping(value="/queryById")
	@ResponseBody
	public Person queryById(Integer id) {
		Person person = ps.queryById(id);
		System.out.println(person);
		
		return person;
	}
	
	@RequestMapping(value ="/queryPersons")
	@ResponseBody
	public List<Person> showPersons(){
		
		return ps.queryAll();
	}
}
